// ValidationAspects
// Written by Mike Saunders
// Released under Microsoft Public License (Ms-PL)
using System;
using NUnit.Framework;
using ValidationAspects.Sdk;

namespace TestValidationAspects.Sdk
{
	[TestFixture]
	public class TestEnforce
	{
		#region Test IsNotNull
		[Test]
		public void Test_IsNotNull_soes_not_throws_for_non_null_param()
		{
			Enforce.IsNotNull(new object(), "name");
		}

		[Test]
		public void Test_IsNotNull_thorws_for_null_value()
		{
			Test.Throws<ArgumentNullException>(() => Enforce.IsNotNull(null, "name"), new ArgumentNullException("name").Message);
		}
		#endregion

		#region Test IsNotNullOrEmpty
		[Test]
		public void Test_IsNotNullOrEmpty_does_not_throws_for_non_null_or_empty_string_param()
		{
			Enforce.IsNotNullOrEmpty("value", "name");
		}

		[Test]
		public void Test_IsNotNullOrEmpty_thorws_for_null_value()
		{
			Test.Throws<ArgumentNullException>(() => Enforce.IsNotNullOrEmpty(null, "name"), new ArgumentNullException("name").Message);
		}

		[Test]
		public void Test_IsNotNullOrEmpty_thorws_for_empty_string_value()
		{
			Test.Throws<ArgumentNullException>(() => Enforce.IsNotNullOrEmpty(string.Empty, "name"), new ArgumentNullException("name").Message);
		}
		#endregion
	}
}